import request from '@/config/axios'
import type { State } from './types'

export const getStatesListApi = (params: any): Promise<IResponse> => {
  return request.get({ url: '/states', params })
}

export const createStatesApi = (data: Partial<State>): Promise<IResponse> => {
  return request.post({ url: '/states', data })
}

export const updateStatesApi = (id: string, data: Partial<State>): Promise<IResponse> => {
  return request.put({ url: `/states/id/${id}`, data })
}

export const getStatesDetailApi = (id: string): Promise<IResponse<State>> => {
  return request.get({ url: `/states/id/${id}` })
}

export const delStatesListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.delete({ url: `/states/id/${ids[0]}` })
}
